//
//  ViewController.m
//  CoreAnimation
//
//  Created by 张国文 on 16/10/8.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "ViewController.h"
#import "GuestImageViewController.h"
#import "FirstChapterViewController.h"
#import "SecondChapterViewController.h"
#import "ThirdChaperViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
    NSLog(@"name=%@", NSLocalizedString(@"name", @"这是一句注解，根据情况写"));
    NSUserDefaults *defau = [NSUserDefaults standardUserDefaults];
    NSArray *languages = [defau valueForKey:@"AppleLanguages"];
    NSLog(@"所支持的语言：%@", languages);
    
    NSString *currentLanguage = [[NSLocale preferredLanguages] firstObject];
    NSLog(@"当前的语言：%@", currentLanguage);
    
    [self.navigationController.navigationBar setTranslucent:NO];
    
    UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    firstButton.frame = CGRectMake(0, 20, 150, 50);
    [firstButton setTitle:@"寄宿图" forState:UIControlStateNormal];
    [firstButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    firstButton.tag = 100;
    [firstButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:firstButton];
    
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sectionButton.frame = CGRectMake(0, 70, 150, 50);
    [sectionButton setTitle:@"图形几何学" forState:UIControlStateNormal];
    [sectionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sectionButton.tag = 101;
    [sectionButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sectionButton];
    
    UIButton *thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    thirdButton.frame = CGRectMake(0, 120, 150, 50);
    [thirdButton setTitle:@"Layer视觉效果" forState:UIControlStateNormal];
    [thirdButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    thirdButton.tag = 102;
    [thirdButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:thirdButton];
    
    
    
}

- (void)clickJump:(UIButton *)button
{
    switch (button.tag) {
        case 100:
        {
            FirstChapterViewController *firstChapterVC = [[FirstChapterViewController alloc] init];
            [self.navigationController pushViewController:firstChapterVC animated:YES];
            break;
        }
            case 101:
        {
            SecondChapterViewController *secondChapterVC = [[SecondChapterViewController alloc] init];
            [self.navigationController pushViewController:secondChapterVC animated:YES];
            break;
        }
            case 102:
        {
            ThirdChaperViewController *thirdChapterVC = [[ThirdChaperViewController alloc] init];
            [self.navigationController pushViewController:thirdChapterVC animated:YES];
            break;
        }
        default:
            break;
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
